import React from 'react'
// ===================================================================== Temp
import SearchForm from '#cpt/temp/SearchForm'
import Table from '#cpt/temp/Table'
// ===================================================================== global declare
const { $fn, $Lazy, globalConfig:{COVIDUrl} } = window
// ===================================================================== $Lazy
const Page 		= $Lazy.load(()=>import('#tp/page/page-container'))
const $time 	= $Lazy.file(()=>import('@com/utils/time'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		details:[],
		beforeDetails: [],
		// 搜索表单列表
		forms : [
			{ label: '标本条码',		name: 'spec_code' },
			{ label: '操作时间',		names: ['created_at_start','created_at_end'],	name:'jz-time',	type:'date-range', 	loading:true },
		]
	}
	
	componentDidMount(){
		$time.then(f=>{
			const arr = f.duration['7-0-24']()
			this.resetModel = { created_at_start: arr[0], created_at_end: arr[1], 'jz-time':arr }
			this.model = $fn.copy(this.resetModel)
			this.fetch()
		})
	}
	
	// paging
	fetch = () => $fn.fetch.call(this,COVIDUrl+'splogs/query',{COVID:true,isIndex:true})
	
	// 表单
	cols = [
		{ title: 'Id', 			dataIndex: 'id', 				...$fn.table.num },
		{ title: '条码号', 		dataIndex: 'specCode', 		width: 100 },
		{ title: '操作人', 		dataIndex: 'operatorName', 	...$fn.table.name},
		{ title: '操作时间', 	dataIndex: 'createdAt',  	...$fn.table.time},	
		{ title: '描述', 		dataIndex: 'title', 			width:700 },
	]
	
	render(){
		return (
			<Page title='标本日志'>
				{/* 搜索 */}
				{ SearchForm.call(this, {timeStr:'7-0-24'}) }
				{/* 表格 */}
				{ Table.call(this,{isIndex:true}) }
			</Page>
		)
	}
}

export default Index